package cn.lzy.personalcenter.service.impl;

import cn.lzy.personalcenter.mapper.mapper.UserMapper;
import cn.lzy.personalcenter.mapper.pojo.User;

import cn.lzy.personalcenter.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAll() {
        List<User> users = userMapper.selectAll();
        for (User user : users) {
            if (user.getMi_email()==null||user.getMi_status()=="normal") {
                user.setMi_email("未绑定");
                user.setMi_status("普通");
            }
            user.setMi_phone(user.getMi_phone().substring(0, 3) + "****" + user.getMi_phone().substring(7, user.getMi_phone().length()));
        }
        return users;
    }


}
